<div class="content">
    <div id="example_title">
        <h1>Show/Hide Items</h1>
        You can show/hide items to the sidebar during the run time. The library will automatically refresh the portion of the sidebar that
        needs rebuilding.
    </div>
    <div id="example_view"></div>
    <div id="example_code"></div>
</div>

<!--CODE-->
<div id="sidebar" style="height: 300px; width: 200px; float: left"></div>
<div style="margin-left: 220px;">
    <button class="w2ui-btn" onclick="action('hide', ['level-1-1', 'level-1-3'])">Hide Some</button>
    <button class="w2ui-btn" onclick="action('show', ['level-1-1', 'level-1-3'])">Show All</button>
</div>
<div style="clear: both"/>

<!--CODE-->
<script type="module">
import { w2sidebar } from '__W2UI_PATH__'

let sidebar = new w2sidebar({
    box: '#sidebar',
    name: 'sidebar',
    img: null,
    nodes: [
        { id: 'level-1', text: 'Level 1', img: 'icon-folder', expanded: true, group: true,
            nodes: [
                { id: 'level-1-1', text: 'Level 1.1', icon: 'fa fa-star-o' },
                { id: 'level-1-2', text: 'Level 1.2', icon: 'fa fa-star-o' },
                { id: 'level-1-3', text: 'Level 1.3', icon: 'fa fa-star-o' }
            ]
        }
    ]
})

window.action = function (method, ids) {
    sidebar[method](...ids)
}
</script>
